package org.me.SendSMS.utli;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class DateUtli {
	private static Calendar cal 			= null;
	private static SimpleDateFormat sdf 	= null;	
	public static String FORMAT_DATE_TIME 	= "yyyy-MM-dd HH:mm:ss";
	
	public static String getDateTime()
	{
	    cal = Calendar.getInstance();
	    sdf = new SimpleDateFormat(FORMAT_DATE_TIME);
	    
	    return sdf.format(cal.getTime());
	}
	
	public static String SpilitTime()
	{
		String date = getDateTime();
		String []array = date.split(" ");
		String []arrayTime = array[1].split(":");
		GlobalVariable.HOURS_CURRENT =Integer.parseInt(arrayTime[0]);
		GlobalVariable.MINUTE_CURRENT =Integer.parseInt(arrayTime[1]);
		GlobalVariable.HOURS_CURRENT_LOOP = Integer.parseInt(arrayTime[0]);;
		GlobalVariable.MINUTE_CURRENT_LOOP = Integer.parseInt(arrayTime[1]);;
		
		return arrayTime[0] +":"+ arrayTime[1];
		
	}
	
	public static String SpilitTimeForServices()
	{
		String date = getDateTime();
		String []array = date.split(" ");
		String []arrayTime = array[1].split(":");
		return arrayTime[0] +":"+ arrayTime[1];
	}
	
	public static String SpilitDate()
	{
		String date = getDateTime();
		String []array = date.split(" ");
		String []arrayDate = array[0].split("-");
		GlobalVariable.DATE_CURRENT = Integer.parseInt(arrayDate[2]);
		GlobalVariable.MONTH_CURRENT = Integer.parseInt(arrayDate[1]);
		GlobalVariable.YEAR_CURRENT = Integer.parseInt(arrayDate[0]);
		return arrayDate[2] + "/"+arrayDate[1] + "/"+arrayDate[0];
		
	}
	
	

}
